﻿ 
using System;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data; 

namespace NTTDATA.BEENChina.ResultCertification.DataStore
{
    public class ImageFileDownloadAccess : IImageFileDownload
    {

        private static string ConnectionString
        {
            get { return Util.ConnectHelper.GetImageBackupDatabaseConnstring(); }
        }

        
       
        public string GetImageDownLoadParam(string orderid)
        {
            string sql = " SELECT   Note+'_'+SavePath  FROM b_FileDownLoad  WHERE   OrderCode = @OrderCode  AND FileDownLoadState = 4 ";

            SqlParameter[] sqlParameters = 
                {
                    new SqlParameter("@OrderCode",  orderid)
                };

            try
            {
               var result = SqlHelper.ExecuteScalar(ConnectionString, System.Data.CommandType.Text, sql, sqlParameters);
               
                if (result != null )
               {
                   return result.ToString();
               }

            }
            catch (Exception ex)
            {
                Log.Console.Error("ImageFileDownloadAccess.GetImageData", ex);
            }

            return string.Empty;
        }
    }
}
